home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
EnigmA Amiga Run 1997 July
/
EnigmA AMIGA RUN 20 (1997)(G.R. Edizioni)(IT)[!][issue 1997-07 & 08][EAR-CD IV].iso
/
earcd
/
comm
/
thor
/
dmthor.lha
/
DMThor.thor
< prev
Wrap
Text File
|
1997-04-25
|
8KB
|
338 lines
/*
** Filename: DMThor.thor
**
** $VER: v1.52 (25APR97)
**
** Author: Troy E. Bouchard
**
** Address: 811 Thorsheim
** Kodiak, AK 99615
** USA
**
** EMail: tbouchar@ptialaska.net
** Webpage: http://www.ptialaska.net/~tbouchar
**
**
** Requires: Thor v2.1+ - Although this script was written with
** Thor v2.4 - it should work with versions 2.1 and up
** (not tested though)
**
*/
options results
/* Find our Thor Port and number! */
p = Address() || ' ' || show('P',,)
ThorPort = pos('THOR.',p)
if ThorPort > 0 then ThorPort = word(substr(p,ThorPort),1)
else
do
say "Can't seem to find the Thor port!"
exit 10
End
/* Load the BBSRead library up! */
if ~show('p', 'BBSREAD') then
do
address command
"run >nil: `GetEnv THOR/THORPath`bin/LoadBBSRead"
"WaitForPort BBSREAD"
End
SIGNAL ON SYNTAX
SIGNAL ON HALT
MDF_DELETED = 5 /* Message is deleted */
MDF_UNRECOVERABLE = 6 /* Message is unrecoverable */
TB_MSGPATH = 'T:'
TB_MYDATE = Translate(Date(),," ","_")
Call GetPages
Call Done
GetPages:
Address BBSREAD
'GETBBSLIST stem "'BBSLIST'"'
if(rc ~=0) then
do
Address(ThorPort)
'REQUESTNOTIFY TEXT "'BBSREAD.LASTERROR'" BT "_OK"'
call cleanup
End
Address(ThorPort)
'REQUESTLIST instem "'BBSLIST'" outstem "'TB_SYSTEM'" title "Selection:" DRAGSELECT MULTISELECT SIZEGADGET'
if(rc ~= 0) then exit
do i=1 to TB_SYSTEM.COUNT
Address BBSREAD
'GETCONFLIST "'TB_SYSTEM.i'" CONFLIST'
if(rc ~= 0) then
do
Address(ThorPort)
'REQUESTNOTIFY TEXT "'BBSREAD.LASTERROR'" BT "_OK"'
call cleanup
End
Address(ThorPort)
'REQUESTLIST instem "'CONFLIST'" title "Select conference on ' || TB_SYSTEM.i || ":" ||'" SIZEGADGET'
if(rc ~= 0) then TB_CONFNAME = ""
else TB_CONFNAME = result
MyConf = Translate(TB_CONFNAME,," ","_")
Address BBSREAD
'GETCONFDATA BBSName "'TB_SYSTEM.i'" ConfName "'TB_CONFNAME'" Stem CDATA'
if(rc ~= 0) then
do
Address(ThorPort)
'REQUESTNOTIFY TEXT "'BBSREAD.LASTERROR'" BT "_OK"'
call cleanup
End
Call MessageHeader
Call TopicText
Address(ThorPort)
'OPENPROGRESS TITLE " DMThor v1.52" PT "Getting Messages..." AT "_Abort" PCW 30'
if(rc ~= 0) then
do
'REQUESTNOTIFY TEXT "'THOR.LASTERROR'" BT "_OK"'
call cleanup
end
else win = result
msgnumber = 0
do j = CDATA.FIRSTMSG to CDATA.LASTMSG
Drop MsgData.
Drop HeaderInfo.
Drop TextInfo.
Address BBSREAD
'READBRMESSAGE "'TB_SYSTEM.i'" "'TB_CONFNAME'" MSGNR "'j'" DataStem "'MsgData'"'
if(rc ~= 0) then
do
Address(ThorPort)
'REQUESTNOTIFY TEXT "'BBSREAD.LASTERROR'" BT "_OK"'
call cleanup
end
if (bittst(MsgData.FLAGS,MDF_DELETED) = 0 & bittst(MsgData.FLAGS, MDF_UNRECOVERABLE) = 0) then
do
msgnumber = msgnumber + 1
Address(ThorPort)
msgtext = 'Saving Messages to: 'MyConf||'.'||TB_MYDATE
'UPDATEPROGRESS REQ "'win'" TOTAL "'CDATA.NUMMESSAGES'" CURRENT "'msgnumber'" PT "'msgtext'"'
if(rc ~= 0) then do
call cleanup
end
Address BBSREAD
'READBRMESSAGE "'TB_SYSTEM.i'" "'TB_CONFNAME'" MSGNR "'j'" TextStem "'TextInfo'" HeadStem "'HeaderInfo'"'
if(rc ~= 0) then
do
Address(ThorPort)
'REQUESTNOTIFY TEXT "'BBSREAD.LASTERROR'" BT "_OK"'
call Cleanup
end
'AMIGA2DATE "'HeaderInfo.CREATIONDATE'" Stem "'Time'"'
if(rc ~= 0) then
do
NewTime = value('HeaderInfo.CREATIONDATETXT')
Say ''
Say 'OH NO! CREATIONDATE IS SET TO TEXT!'
Say NewTime
Say 'Delete Message nr: 'j' and try again'
call Cleanup
end
if symbol('HeaderInfo.FROMADDR') = "VAR" then
Addr = value('HeaderInfo.FROMADDR')
if symbol('HeaderInfo.FROMNAME') = "VAR" then
Nom = value('HeaderInfo.FROMNAME')
if symbol('HeaderInfo.SUBJECT') = "VAR" then
Subj = value('HeaderInfo.SUBJECT')
if symbol('HeaderInfo.TOADDR') = "VAR" then
ToAdd = value('HeaderInfo.TOADDR')
Call MessageText
end
end
end
Return
Done:
Address(ThorPort)
'REQUESTNOTIFY TEXT " We Are Done!\nDigest Files Copied!" BT "_Cool!"'
'CLOSEPROGRESS REQ' win
Call DelMSGS
MessageHeader:
Call Open out, TB_MSGPATH || MyConf || '.'||TB_MYDATE, w
Call WriteLN out, ' '|| MyConf || ' Digest for '||Date()
Call WriteLN out, ' '
Call WriteLN out, 'Topics for Conference 'MyConf||':'
Call WriteLN out, ' '
Call Close out
Return
TopicText:
Address(ThorPort)
'OPENPROGRESS TITLE " DMThor v1.52" PT "Getting Topics..." AT "_Abort" PCW 30'
if(rc ~= 0) then
do
'REQUESTNOTIFY TEXT "'THOR.LASTERROR'" BT "_OK"'
call cleanup
end
else win = result
msgnbr = 0
do k = CDATA.FIRSTMSG to CDATA.LASTMSG
Drop HeaderInfo.
Drop MsgData.
Address BBSREAD
'READBRMESSAGE "'TB_SYSTEM.i'" "'TB_CONFNAME'" MSGNR "'k'" DataStem "'MsgData'"'
if(rc ~= 0) then
do
Address(ThorPort)
'REQUESTNOTIFY TEXT "'BBSREAD.LASTERROR'" BT "_OK"'
call cleanup
end
if (bittst(MsgData.FLAGS,MDF_DELETED) = 0 & bittst(MsgData.FLAGS, MDF_UNRECOVERABLE) = 0) then
do
msgnbr = msgnbr + 1
Address(ThorPort)
msgtext = 'Saving Topics to: 'MyConf||'.'TB_MYDATE
'UPDATEPROGRESS REQ "'win'" TOTAL "'CDATA.NUMMESSAGES'" CURRENT "'msgnbr'" PT "'msgtext'"'
if(rc ~= 0) then do
call cleanup
end
Address BBSREAD
'READBRMESSAGE "'TB_SYSTEM.i'" "'TB_CONFNAME'" MSGNR "'k'" HeadStem "'HeaderInfo'"'
if(rc ~= 0) then
do
Address(ThorPort)
'REQUESTNOTIFY TEXT "'BBSREAD.LASTERROR'" BT "_OK"'
call Cleanup
end
'AMIGA2DATE "'HeaderInfo.CREATIONDATE'" Stem "'Time'"'
if(rc ~= 0) then
do
NewTime = value('HeaderInfo.CREATIONDATETXT')
Say ''
Say 'OH NO! CREATIONDATE IS SET TO TEXT!'
Say 'I can not resolve something like this yet!'
Say 'Delete Message nr: 'k' and try again'
call Cleanup
end
if symbol('HeaderInfo.FROMADDR') = "VAR" then
Addr = value('HeaderInfo.FROMADDR')
if symbol('HeaderInfo.FROMNAME') = "VAR" then
Nom = value('HeaderInfo.FROMNAME')
if symbol('HeaderInfo.SUBJECT') = "VAR" then
Subj = value('HeaderInfo.SUBJECT')
Call Open out, TB_MSGPATH || MyConf || '.'||TB_MYDATE, a
Call WriteLN out, msgnbr'. 'Subj
Call WriteLN out, ' by 'Nom' ('Addr')'
Call WriteLN out, ' '
Call Close out
end
end
if (win ~= 0) & Symbol('win') = 'VAR' then do
Address(ThorPort)
'CloseProgress REQ' win
end
Return
MessageText:
Call Open out, TB_MSGPATH || MyConf || '.'||TB_MYDATE,a
Call WriteLN out, '-------------------------------------'
Call WriteLN out, 'From: 'Nom' ('Addr')'
Call WriteLN out, 'To: 'ToAdd
Call WriteLN out, 'Subject: 'Subj
Call WriteLN out, ' '
cnt = value('TextInfo.TEXT.COUNT')
if(cnt = 0) then call writeln(out,'No Text')
else
do
do n = 1 to cnt
call writeln(out, value('TextInfo.TEXT.n'))
end
Call Close out
end
Call Close out
Return
DelMSGS:
if (bittst(MsgData.FLAGS,MDF_DELETED) = 0 & bittst(MsgData.FLAGS, MDF_UNRECOVERABLE) = 0) then
do
Address(ThorPort)
'REQUESTNOTIFY TEXT "Delete Messages in\nConference 'MyConf'?" BT "_NO|_OK"'
if(rc ~= 0) then
do
'REQUESTNOTIFY TEXT "'THOR.LASTERROR'" BT "_OK"'
Call Cleanup
End
if(result = 0) then Call DelProgress
if(result = 1) then Call Cleanup
End
'REQUESTNOTIFY TEXT "No messages to Delete!" BT "_OK"'
DelProgress:
'CURRENTSYSTEM stem "'TB_SYS'"'
'OPENPROGRESS TITLE "Deleting messages" PT "Getting messages..." AT "_Abort" PCW 30'
if(rc = 0) then
do
win = result
do d=CDATA.FIRSTMSG to CDATA.LASTMSG
Address(ThorPort)
'UPDATEPROGRESS REQ "'win'" TOTAL "'CDATA.NUMMESSAGES'" CURRENT "'d-CDATA.FIRSTMSG+1'" PT "Deleting message # 'd'" '
if(rc ~= 0) then
do
'REQUESTNOTIFY TEXT "'THOR.LASTERROR'" BT "_OK"'
Call Cleanup
end
Address BBSRead
'UPDATEBRMESSAGE "'TB_SYS.BBSNAME'" "'MyConf'" "'d'" SETDELETED'
if(rc ~= 0) then
do
'REQUESTNOTIFY TEXT "'BBSREAD.LASTERROR'" BT "_OK"'
Call Cleanup
end
end
end
Call Cleanup
SYNTAX:
SAY 'Error: 'rc' in line 'sigl': 'errortext(rc)
HALT:
cleanup:
IF (win ~= 0) & SYMBOL('win') = 'VAR' THEN DO
ADDRESS(ThorPort)
'CLOSEPROGRESS REQ' win
END
EXIT